import request from '@/axios'
import {
  DepartmentListResponse,
  DepartmentUserParams,
  DepartmentUserResponse,
  auditGoodsParams
} from './types'

export const getGoodsApi = () => {
  return request.get({ url: '/api/basegoods' })
}

export const getUserByIdApi = (params: DepartmentUserParams) => {
  return request.get<DepartmentUserResponse>({ url: '/mock/department/users', params })
}

export const deleteUserByIdApi = (ids: string[] | number[]) => {
  return request.post({ url: '/mock/department/user/delete', data: { ids } })
}

export const saveUserApi = (data: any) => {
  return request.post({ url: '/mock/department/user/save', data })
}

export const saveApi = (data: any) => {
  return request.post({ url: '/api/basegoods', data })
  // if (data.Id) return request.put({ url: '/api/basegoods', data })
  // else
}

export const auditApi = (data: auditGoodsParams) => {
  return request.post({ url: '/api/basegoods/audit', data })
}

export const deleteDepartmentApi = (ids: string[] | number[]) => {
  return request.post({ url: '/mock/department/delete', data: { ids } })
}

export const getDepartmentTableApi = (params: any) => {
  return request.get({ url: '/api/basegoods', params })
}
